package com.hcy.rabbitruntimeapi.controller;

import com.hcy.rabbitbasicmodel.model.ReturnResult;
import com.hcy.rabbitruntimeapi.center.CenterHandlerLink;
import com.hcy.rabbitbasicmodel.common.MyWebSocketMessage;
import com.hcy.rabbitruntimeapi.model.message.driver.UploadTrackPointsDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author huchenying
 * @Description
 * @Date 2021/12/15 13:47
 */
@RestController
public class IndexController {

    @Autowired
    CenterHandlerLink centerHandlerLink;

    @GetMapping("/getSome")
    public ReturnResult getSome() {
        MyWebSocketMessage myWebSocketMessage = new MyWebSocketMessage();
        myWebSocketMessage.setCode(1001);
        myWebSocketMessage.setDesc("测试");
        UploadTrackPointsDTO uploadTrackPointsDTO = new UploadTrackPointsDTO();
        uploadTrackPointsDTO.setLat(1.1);
        uploadTrackPointsDTO.setLog(1.1);
        uploadTrackPointsDTO.setTid(1);
        myWebSocketMessage.setData(uploadTrackPointsDTO);
        centerHandlerLink.handler(myWebSocketMessage);

        return ReturnResult.success("请求成功！");
    }
}
